package com.ruoyi.controller;

import com.ruoyi.pojo.ResultVo;
import com.ruoyi.pojo.SearchVo;
import com.ruoyi.pojo.TbCard;
import com.ruoyi.service.CardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("card")
public class CardController {

    @Autowired
    private CardService cardService;

    /**
     * 查询列表
     * @param searchVo
     * @return
     */
    @RequestMapping("list")
    public ResultVo list(@RequestBody SearchVo searchVo){
        return cardService.searchList(searchVo);
    }

    /**
     * 保存
     * @param tbCard
     * @return
     */
    @RequestMapping("savewwww")
    public ResultVo savewwww(@RequestBody TbCard tbCard){
        cardService.save(tbCard);
        return new ResultVo(200,"保存成功",null);
    }

    /**
     * 保存
     * @param tbCard
     * @return
     */
    @RequestMapping("save")
    public ResultVo save(@RequestBody TbCard tbCard){
         cardService.save(tbCard);
         return new ResultVo(200,"保存成功",null);
    }

     /**
     * 查询列表
     * @param searchVo
     * @return
     */
    @RequestMapping("lists")
    public ResultVo lists(@RequestBody SearchVo searchVo){
        return cardService.searchList(searchVo);
    }

    /**
     * 保存
     * @param tbCard
     * @return
     */
    @RequestMapping("saves")
    public ResultVo saves(@RequestBody TbCard tbCard){
        cardService.save(tbCard);
        return new ResultVo(200,"保存成功",null);
    }


 /**
     * 保存
     * @param tbCard
     * @return
     */
    @RequestMapping("savesssss")
    public ResultVo savesssss(@RequestBody TbCard tbCard){
        cardService.save(tbCard);
        return new ResultVo(200,"保存成功",null);
    }


    /**
     * 删除
     * @param
     * @return
     */
    @RequestMapping("deletewwww")
    public ResultVo deletewwww(int id){
        cardService.removeById(id);
        return new ResultVo(200,"删除成功",null);
    }


    /**
     * 删除
     * @param
     * @return
     */
    @RequestMapping("delete")
    public ResultVo delete(int id){
         cardService.removeById(id);
         return new ResultVo(200,"删除成功",null);
    }


}
